{extend name="public/pure"}
{block name="style"}
<title>商品详情</title>
<link rel="stylesheet" href="/home/css/commodity/detail.css">

{/block}
{block name="body"}

<div class="content">
    <div class="img">
        <img src="{$info.front_cover}" alt="">
    </div>
    <div class="tpm">
        <div class="titlePrice clearfix">
            <div class="title fl">{$info.title}</div>
            <div class="price fr">￥<span>{$info.price1}</span>.<span class="span">{$info.price2}</span></div>
        </div>
        <div class="massage clearfix">
            <ul>
                <li class="fl"><span>快递：</span><span>到付</span></li>
                <li class="fl"><span>库存：</span><span>{$info.stock}</span></li>
                <li class="fl"><span>浙江 淳安</span></li>
            </ul>
        </div>
    </div>
</div>
<div class="detail">
    <div class="detailTitle">
        <div>
            <span>详情</span>
        </div>
    </div>
    <div class="detailContent">
        {$info.content}
    </div>
</div>

<div class="footer clearfix">
    <div class="fl custom">
        <div class="img"><img src="/home/images/commodity/custom.png" alt=""></div>
        <p>客服</p>
    </div>
    <div class="fr btn">
        <ul class="clearfix">

            {if condition="($info['stock'] == 0)"}
            <li class="fl"><a href="">加入购物车</a></li>
            <li class="fr"><a href="">立即购买</a></li>
            {else /}
            <li class="fl"><a href="javascript:;">加入购物车</a></li>
            <li class="fr"><a href="javascript:;">立即购买</a></li>
            {/if}

        </ul>
    </div>
</div>

<!-- 客服-->
<div class="showdow"></div>
<div class="kefu">
    <div class="img">
        <img src="/home/images/commodity/kefu.png" alt="">
    </div>
    <div class="content">
        商城客服将会全心全意为您提供满意周到的咨询服务，也希望您能支持和监督我们的服务！
    </div>
    <div class="btn">
        <a href="tel:88722001">
            <span>拨打客服热线</span>
        </a>
    </div>
    <p>求助人工服务，获得快速解答</p>
</div>

{/block}
{block name="script"}
<script src="/home/js/reset.js"></script>
<script>
    // 客服弹窗
    $(".custom").on("click", function () {
        $(".showdow,.kefu").show();
    });

    $(".showdow").on("click", function () {
        $(this).hide();
        $(".kefu").hide();
    });


    // 加入购物车
    $(".btn li:first-of-type").on("click", function () {
        var id = "{$info.id}";
        $.ajax({
            type: "post",
            url: "{:Url('Cart/add')}",
            data: {
                id: id
            },
            success: function (data) {
                swal({
                    title: ' ',
                    text: '添加成功!',
                    type: 'success',
                    showConfirmButton:false,
                    timer: 1500
                });
            }
        })
    });

    // 立即购买
    $(".btn li:last-of-type").on("click", function () {
        var id = "{$info.id}";
        $.ajax({
            type: "post",
            url: "{:Url('Cart/add')}",
            data: {
                id: id
            },
            success: function (data) {
//                window.location.href = ""
            }
        })
    });

    // 图片懒加载
    function lazy() {
        $("img.lazy").lazyload({
            placeholder: "/home/images/loading.jpg",
            effect: "fadeIn",
            threshold: 1
        });
    }
    lazy();
</script>
{/block}